package UnitTest.DataStructureTest.arrayAndListTest.findValueTest;

import Top100.GetMostValueofOrderArray;
import DataStructure.arrayAndList.findValue.GetMostValueofOrderArrayImpl_recursion;
import DataStructure.arrayAndList.findValue.GetMostValueofOrderArrayImpl;
import org.junit.Test;

/**
 * @author liujun
 * @version 1.0
 * @date 2020/8/20
 * @author—Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 测试案例
 * 一个有序数组，比如[1,2,3,4,5,6,7],
 * 后面部分被替换到前面，比如[5,6,7,1,2,3,4],找出替换后的数组的最小值
 */
public class GetMinValueofOrderArrayTest extends GetMostValueofOrderArrayTestData {


    @Test
    public void testgetMin() {
        test(new GetMostValueofOrderArrayImpl_recursion());
    }

    @Test
    public void testgetMin_1() {
        test(new GetMostValueofOrderArrayImpl());
    }


    public void test(GetMostValueofOrderArray find) {
        int value = find.getMinValue(demoarray01);
        assert value == targetMin01;
        value = find.getMinValue(demoarray011);
        assert value == targetMin011;
        value = find.getMinValue(demoarray012);
        assert value == targetMin012;
        value = find.getMinValue(demoarray02);
        assert value == targetMin02;
        value = find.getMinValue(demoarray03);
        assert value == targetMin03;
        value = find.getMinValue(demoarray04);
        assert value == targetMin04;
        value = find.getMinValue(demoarray05);
        assert value == targetMin05;
        value = find.getMinValue(demoarray06);
        assert value == targetMin06;
        value = find.getMinValue(demoarray07);
        assert value == targetMin07;

        value = find.getMinValue(demoarray08);
        assert value == targetMin08;
        value = find.getMinValue(demoarray081);
        assert value == targetMin08;
        value = find.getMinValue(demoarray082);
        assert value == targetMin08;
        value = find.getMinValue(demoarray083);
        assert value == targetMin08;
        value = find.getMinValue(demoarray084);
        assert value == targetMin08;

        value = find.getMinValue(demoarray09);
        assert value == targetMin09;
        value = find.getMinValue(demoarray10);
        assert value == targetMin10;
    }

}
